第 2 步:很好!现在我们的舞台已经设置好了,让我们通过在main()中创建我们需要的数据来开始我们的游戏。

  • 我们的游戏会根据用户点击的精灵来增加或减少用户的分数。
  • ,拖动Global Variable缩进你的main函数。确保它是缩进的!
  • my_var更改为score 。我们需要将 score 设为global ,因为我们将在另一个函数中使用它。
  • 最后,在下一行拖入Integer Variablemy_var更改为score并将25更改为0

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)